//
//  HomeSearchLeftCell.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/9/1.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "HomeSearchLeftCell.h"


@interface HomeSearchLeftCell ()

@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UIImageView *arrowImage;

@end
@implementation HomeSearchLeftCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        _leftView = [UIView new];
        _leftView.backgroundColor = ColorFrom16(0xFFD338);
        _leftView.hidden = YES;
        [self addSubview:_leftView];
        [_leftView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.and.bottom.equalTo(self);
            make.width.equalTo(@4);
            make.left.equalTo(self);
        }];
        
        _imgView = [UIImageView new];
        _imgView.image = IMAGE(@"");
        _imgView.layer.backgroundColor = ColorFrom16(0xFEDE6D).CGColor;
        _imgView.layer.cornerRadius = 2;
        [self addSubview:_imgView];
        [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(_leftView.mas_right).offset(16);
            make.width.equalTo(@16);
            make.height.equalTo(@16);
        }];
        
        _label = [UILabel new];
        _label.textColor = ColorFrom16(0x666666);
        _label.font = PFRFONT(14);
        [self addSubview:_label];
        [_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(_imgView.mas_right).offset(10);
            make.width.equalTo(@70);
            make.height.equalTo(@20);
        }];
        
        _arrowImage = [UIImageView new];
        _arrowImage.image = IMAGE(@"");
        [self addSubview:_arrowImage];
        [_arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self).offset(-9);
            make.width.equalTo(@12);
            make.height.equalTo(@12);
        }];
        
        _sortLabel = [UILabel new];
        _sortLabel.hidden = YES;
        _sortLabel.textColor = ColorFrom16(0x666666);
        _sortLabel.font = PFRFONT(14);
        [self addSubview:_sortLabel];
        [_sortLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(_imgView.mas_right).offset(10);
            make.right.equalTo(self);
            make.height.equalTo(@20);
        }];
    }
    return self;
}

- (void)configViewWithModel:(SearchRightModel *)model
{
    LeftModel *leftModel = model.fdata.firstObject;
//    for (NSDictionary *dic in model.fdata) {
        _label.text = leftModel.type_name;
//    }
}

- (void)configNearbyithModel:(SearchNearbyModel *)model
{
    aLeftModel *aleftModel = model.fdata.firstObject;
    _label.text = aleftModel.zone;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
